package com.ihr360.insurance.dao;

import com.ihr360.commons.model.type.BenefitCategory;
import com.ihr360.insurance.model.dto.benefits.MandatoryBenefitsType;
import com.ihr360.rest.reposity.SimpleRestReposity;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

import java.util.Date;
import java.util.List;

@RepositoryRestResource
public interface MandatoryBenefitsTypeReposity extends SimpleRestReposity<MandatoryBenefitsType, Long>,PagingAndSortingRepository<MandatoryBenefitsType, Long> {

//    @RestResource(path = "byCategory")
//    Page findByCategory(@Param("category") BenifitCategory category, Pageable p);

    List<MandatoryBenefitsType> getAllByEnabledAndEffectiveAtLessThanEqual(boolean enabled, Date effectiveAt);

    List<MandatoryBenefitsType> getAllByEnabledAndCategoryAndEffectiveAtLessThanEqual(
            boolean enabled, BenefitCategory category, Date effectiveAt);

    List<MandatoryBenefitsType> getAllByEnabled(boolean enabled);

    List<MandatoryBenefitsType> getAllByEnabledAndEffectiveAtLessThanEqualAndIdIn(
            boolean enabled, Date effectiveAt, List<Long> ids);

    int countByName(String name);
}